//
//  CeilItem.swift
//  cabbage_swift
//
//  Created by dfsx6 on 2021/9/16.
//

import Foundation
import UIKit

//MARK:-
class CeilItem: NSObject {
    
    fileprivate var itemSize: CGSize {
        return CGSize.init(width: UIScreen.main.bounds.width, height: 50)
    }
}


//MARK:-
extension CeilItem: BaseCollectionSectionProtocol {
    
    func registerForCollectionViewCell(_ collectionView: UICollectionView) {
        collectionView.exRegister(cell: CeilICollectionViewCell.self)
    }
    
    func numberOfItemsInSection(_ collectionView: UICollectionView) -> Int {
        return 1
    }
    
    func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        guard let cell = collectionView.exDequeueReusableCell(for: indexPath, cellType: CeilICollectionViewCell.self) else {
            return UICollectionViewCell.init()
        }
        cell.bgViewWidth.constant = itemSize.width
        cell.titleLabel.text = "ceil"
        
        return cell
    }

    func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
        return itemSize
    }
    
    func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
        let targetVC = CeilViewController.init()
        exTopVC?.navigationController?.pushViewController(targetVC, animated: true)
    }
}
